
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>9.1  抽象类 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="9.2接口.html" />
    
    
    <link rel="prev" href="d9z.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    目录
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../d1z/d1z.html">
            
                <a href="../d1z/d1z.html">
            
                    
                    第一章    初识java
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../d1z/1.1计算机语言.html">
            
                <a href="../d1z/1.1计算机语言.html">
            
                    
                    1.1  计算机语言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../d1z/1.2java发展史.html">
            
                <a href="../d1z/1.2java发展史.html">
            
                    
                    1.2  java发展史
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../d1z/1.3Java的特点.html">
            
                <a href="../d1z/1.3Java的特点.html">
            
                    
                    1.3  Java的特点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../d1z/1.4Java程序工作原理.html">
            
                <a href="../d1z/1.4Java程序工作原理.html">
            
                    
                    1.4  Java程序工作原理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../d1z/1.5JavaSE的结构.html">
            
                <a href="../d1z/1.5JavaSE的结构.html">
            
                    
                    1.5  Java SE的结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../d1z/1.6Java开发环境搭建.html">
            
                <a href="../d1z/1.6Java开发环境搭建.html">
            
                    
                    1.6  Java开发环境搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../d1z/1.7第一个Java程序.html">
            
                <a href="../d1z/1.7第一个Java程序.html">
            
                    
                    1.7  第一个Java程序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="../d1z/1.8本章练习.html">
            
                <a href="../d1z/1.8本章练习.html">
            
                    
                    1.8  本章练习
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../d2z/d2z.html">
            
                <a href="../d2z/d2z.html">
            
                    
                    第二章    数据类型和运算符
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../d2z/2.1标识符和关键字.html">
            
                <a href="../d2z/2.1标识符和关键字.html">
            
                    
                    2.1  标识符和关键字
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../d2z/2.2变量和常量.html">
            
                <a href="../d2z/2.2变量和常量.html">
            
                    
                    2.2  变量和常量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../d2z/2.3Java数据类型.html">
            
                <a href="../d2z/2.3Java数据类型.html">
            
                    
                    2.3  Java数据类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../d2z/2.4成员变量和局部变量.html">
            
                <a href="../d2z/2.4成员变量和局部变量.html">
            
                    
                    2.4  成员变量和局部变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../d2z/2.5Java运算符.html">
            
                <a href="../d2z/2.5Java运算符.html">
            
                    
                    2.5  Java运算符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../d2z/2.6Java表达式.html">
            
                <a href="../d2z/2.6Java表达式.html">
            
                    
                    2.6  Java表达式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="../d2z/2.7本章练习.html">
            
                <a href="../d2z/2.7本章练习.html">
            
                    
                    2.7  本章练习
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../d3z/d3z.html">
            
                <a href="../d3z/d3z.html">
            
                    
                    第三章    流程控制
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../d3z/3.1if语句.html">
            
                <a href="../d3z/3.1if语句.html">
            
                    
                    3.1  if语句
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../d3z/3.2switch语句.html">
            
                <a href="../d3z/3.2switch语句.html">
            
                    
                    3.2  switch语句
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../d3z/3.3循环语句.html">
            
                <a href="../d3z/3.3循环语句.html">
            
                    
                    3.3  循环语句
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../d3z/3.4本章练习.html">
            
                <a href="../d3z/3.4本章练习.html">
            
                    
                    3.4  本章练习
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../d4z/d4z.html">
            
                <a href="../d4z/d4z.html">
            
                    
                    第四章    方法与数组
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../d4z/4.1方法.html">
            
                <a href="../d4z/4.1方法.html">
            
                    
                    4.1  方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../d4z/4.2数组.html">
            
                <a href="../d4z/4.2数组.html">
            
                    
                    4.2  数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../d4z/4.3二维数组.html">
            
                <a href="../d4z/4.3二维数组.html">
            
                    
                    4.3  二维数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../d4z/4.4本章练习.html">
            
                <a href="../d4z/4.4本章练习.html">
            
                    
                    4.4  本章练习
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../d5z/d5z.html">
            
                <a href="../d5z/d5z.html">
            
                    
                    第五章    String字符串
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../d5z/5.1String类.html">
            
                <a href="../d5z/5.1String类.html">
            
                    
                    5.1  String类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../d5z/5.2String类的常用方法.html">
            
                <a href="../d5z/5.2String类的常用方法.html">
            
                    
                    5.2  String类的常用方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../d5z/5.3JavaAPI文档的使用.html">
            
                <a href="../d5z/5.3JavaAPI文档的使用.html">
            
                    
                    5.3  Java API文档的使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../d5z/5.4StringBuffer类.html">
            
                <a href="../d5z/5.4StringBuffer类.html">
            
                    
                    5.4  StringBuffer类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../d5z/5.5本章练习.html">
            
                <a href="../d5z/5.5本章练习.html">
            
                    
                    5.5  本章练习
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../d6z/d6z.html">
            
                <a href="../d6z/d6z.html">
            
                    
                    第六章    类和对象
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../d6z/6.1类和对象概述.html">
            
                <a href="../d6z/6.1类和对象概述.html">
            
                    
                    6.1  类和对象概述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../d6z/6.2Java类.html">
            
                <a href="../d6z/6.2Java类.html">
            
                    
                    6.2  Java类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../d6z/6.3构造方法.html">
            
                <a href="../d6z/6.3构造方法.html">
            
                    
                    6.3  构造方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../d6z/6.4对象初始化过程.html">
            
                <a href="../d6z/6.4对象初始化过程.html">
            
                    
                    6.4  对象初始化过程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../d6z/6.5重载.html">
            
                <a href="../d6z/6.5重载.html">
            
                    
                    6.5  重载
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../d6z/6.6本章练习.html">
            
                <a href="../d6z/6.6本章练习.html">
            
                    
                    6.6  本章练习
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../d7z/d7z.html">
            
                <a href="../d7z/d7z.html">
            
                    
                    第七章    包和访问控制
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../d7z/7.1Java包.html">
            
                <a href="../d7z/7.1Java包.html">
            
                    
                    7.1  Java包
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../d7z/7.2引用包.html">
            
                <a href="../d7z/7.2引用包.html">
            
                    
                    7.2  引用包
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../d7z/7.3访问权限.html">
            
                <a href="../d7z/7.3访问权限.html">
            
                    
                    7.3  访问权限
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../d7z/7.4static关键字.html">
            
                <a href="../d7z/7.4static关键字.html">
            
                    
                    7.4  static关键字
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.5" data-path="../d7z/7.5本章练习.html">
            
                <a href="../d7z/7.5本章练习.html">
            
                    
                    7.5  本章练习
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../d8z/d8z.html">
            
                <a href="../d8z/d8z.html">
            
                    
                    第八章    继承和多态
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../d8z/8.1抽象和封装.html">
            
                <a href="../d8z/8.1抽象和封装.html">
            
                    
                    8.1  抽象和封装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../d8z/8.2继承.html">
            
                <a href="../d8z/8.2继承.html">
            
                    
                    8.2  继承
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" data-path="../d8z/8.3多态.html">
            
                <a href="../d8z/8.3多态.html">
            
                    
                    8.3  多态
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4" data-path="../d8z/8.4本章练习.html">
            
                <a href="../d8z/8.4本章练习.html">
            
                    
                    8.4  本章练习
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="d9z.html">
            
                <a href="d9z.html">
            
                    
                    第九章    抽象类和接口
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.10.1" data-path="9.1抽象类.html">
            
                <a href="9.1抽象类.html">
            
                    
                    9.1  抽象类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="9.2接口.html">
            
                <a href="9.2接口.html">
            
                    
                    9.2  接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" data-path="9.3本章练习.html">
            
                <a href="9.3本章练习.html">
            
                    
                    9.3  本章练习
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../d10z/d10z.html">
            
                <a href="../d10z/d10z.html">
            
                    
                    第十章    排序算法
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../d10z/10.1排序算法.html">
            
                <a href="../d10z/10.1排序算法.html">
            
                    
                    10.1  排序算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../d10z/10.2本章练习.html">
            
                <a href="../d10z/10.2本章练习.html">
            
                    
                    10.2  本章练习
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >9.1  抽象类</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h2 id="91--&#x62BD;&#x8C61;&#x7C7B;">9.1  &#x62BD;&#x8C61;&#x7C7B;</h2>
<p>&#x2003;&#x2003;&#x5728;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7684;&#x4E16;&#x754C;&#x91CC;&#xFF0C;&#x6240;&#x6709;&#x7684;&#x5BF9;&#x8C61;&#x90FD;&#x662F;&#x901A;&#x8FC7;&#x7C7B;&#x6765;&#x5B9E;&#x4F8B;&#x5316;&#x7684;&#xFF0C;&#x4F46;&#x5E76;&#x4E0D;&#x662F;&#x6240;&#x6709;&#x7684;&#x7C7B;&#x90FD;&#x662F;&#x76F4;&#x63A5;&#x7528;&#x6765;&#x5B9E;&#x4F8B;&#x5316;&#x5BF9;&#x8C61;&#x7684;&#x3002;&#x5982;&#x679C;&#x4E00;&#x4E2A;&#x7C7B;&#x4E2D;&#x6CA1;&#x6709;&#x5305;&#x542B;&#x8DB3;&#x591F;&#x7684;&#x4FE1;&#x606F;&#x6765;&#x63CF;&#x7ED8;&#x4E00;&#x4E2A;&#x5177;&#x4F53;&#x7684;&#x4E8B;&#x52A1;&#xFF0C;&#x8FD9;&#x6837;&#x7684;&#x7C7B;&#x53EF;&#x4EE5;&#x5F62;&#x6210;&#x62BD;&#x8C61;&#x7C7B;&#x3002;</p>
<p>&#x2003;&#x2003;&#x62BD;&#x8C61;&#x7C7B;&#x5F80;&#x5F80;&#x7528;&#x6765;&#x8868;&#x793A;&#x5728;&#x5BF9;&#x4E8B;&#x52A1;&#x8FDB;&#x884C;&#x5206;&#x6790;&#x3001;&#x8BBE;&#x8BA1;&#x540E;&#x5F97;&#x51FA;&#x7684;&#x62BD;&#x8C61;&#x6982;&#x5FF5;&#xFF0C;&#x662F;&#x5BF9;&#x4E00;&#x7CFB;&#x5217;&#x770B;&#x4E0A;&#x53BB;&#x4E0D;&#x540C;&#xFF0C;&#x4F46;&#x662F;&#x672C;&#x8D28;&#x4E0A;&#x76F8;&#x540C;&#x7684;&#x5177;&#x4F53;&#x6982;&#x5FF5;&#x7684;&#x62BD;&#x8C61;&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x5982;&#x679C;&#x8FDB;&#x884C;&#x4E00;&#x4E2A;&#x56FE;&#x5F62;&#x7F16;&#x8F91;&#x8F6F;&#x4EF6;&#x7684;&#x5F00;&#x53D1;&#xFF0C;&#x5C31;&#x4F1A;&#x53D1;&#x73B0;&#x9700;&#x8981;&#x64CD;&#x4F5C;&#x5706;&#x3001;&#x4E09;&#x89D2;&#x5F62;&#x8FD9;&#x6837;&#x4E00;&#x4E9B;&#x5177;&#x4F53;&#x7684;&#x56FE;&#x5F62;&#x6982;&#x5FF5;&#x3002;&#x8FD9;&#x4E9B;&#x5177;&#x4F53;&#x7684;&#x6982;&#x5FF5;&#x867D;&#x7136;&#x662F;&#x4E0D;&#x540C;&#x7684;&#xFF0C;&#x4F46;&#x662F;&#x5B83;&#x4EEC;&#x53C8;&#x90FD;&#x5C5E;&#x4E8E;&#x5F62;&#x72B6;&#x8FD9;&#x6837;&#x4E00;&#x4E2A;&#x4E0D;&#x662F;&#x771F;&#x5B9E;&#x5B58;&#x5728;&#x7684;&#x62BD;&#x8C61;&#x6982;&#x5FF5;&#xFF0C;&#x8FD9;&#x4E2A;&#x62BD;&#x8C61;&#x7684;&#x6982;&#x5FF5;&#x662F;&#x4E0D;&#x80FD;&#x5B9E;&#x4F8B;&#x5316;&#x51FA;&#x4E00;&#x4E2A;&#x5177;&#x4F53;&#x7684;&#x5F62;&#x72B6;&#x5BF9;&#x8C61;&#x7684;&#x3002;</p>
<h3 id="911--&#x62BD;&#x8C61;&#x7C7B;&#x7684;&#x6982;&#x5FF5;">9.1.1  &#x62BD;&#x8C61;&#x7C7B;&#x7684;&#x6982;&#x5FF5;</h3>
<p>&#x2003;&#x2003;&#x5728;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x5206;&#x6790;&#x548C;&#x8BBE;&#x8BA1;&#x7684;&#x8FC7;&#x7A0B;&#x4E2D;&#xFF0C;&#x7ECF;&#x8FC7;&#x62BD;&#x8C61;&#x3001;&#x5C01;&#x88C5;&#x548C;&#x7EE7;&#x627F;&#x7684;&#x5206;&#x6790;&#x4E4B;&#x540E;&#xFF0C;&#x4F1A;&#x9700;&#x8981;&#x60F3;&#x521B;&#x5EFA;&#x8FD9;&#x6837;&#x4E00;&#x4E2A;&#x62BD;&#x8C61;&#x7684;&#x7236;&#x7C7B;&#xFF0C;&#x8BE5;&#x7236;&#x7C7B;&#x5B9A;&#x4E49;&#x4E86;&#x5176;&#x6240;&#x6709;&#x5B50;&#x7C7B;&#x5171;&#x4EAB;&#x7684;&#x4E00;&#x822C;&#x5F62;&#x5F0F;&#xFF0C;&#x5177;&#x4F53;&#x7EC6;&#x8282;&#x7531;&#x5B50;&#x7C7B;&#x6765;&#x5B8C;&#x6210;&#x3002;</p>
<p>&#x2003;&#x2003;&#x8FD9;&#x6837;&#x7684;&#x7236;&#x7C7B;&#x4F5C;&#x4E3A;&#x89C4;&#x7EA6;&#xFF0C;&#x5176;&#x9700;&#x8981;&#x5B50;&#x7C7B;&#x5B8C;&#x6210;&#x7684;&#x65B9;&#x6CD5;&#x5728;&#x7236;&#x7C7B;&#x4E2D;&#x5F80;&#x5F80;&#x662F;&#x7A7A;&#x65B9;&#x6CD5;&#xFF0C;&#x65B9;&#x6CD5;&#x672C;&#x8EAB;&#x6CA1;&#x6709;&#x5B9E;&#x9645;&#x610F;&#x4E49;&#x3002;&#x800C;&#x4E14;&#x8FD9;&#x4E9B;&#x7236;&#x7C7B;&#x672C;&#x8EAB;&#x5C31;&#x6BD4;&#x8F83;&#x62BD;&#x8C61;&#xFF0C;&#x6839;&#x636E;&#x8FD9;&#x4E9B;&#x62BD;&#x8C61;&#x7684;&#x7236;&#x7C7B;&#x5B9E;&#x4F8B;&#x5316;&#x51FA;&#x7684;&#x5BF9;&#x8C61;&#x901A;&#x5E38;&#x4E5F;&#x7F3A;&#x4E4F;&#x5B9E;&#x9645;&#x610F;&#x4E49;&#xFF0C;&#x66F4;&#x591A;&#x7684;&#x662F;&#x5229;&#x7528;&#x7236;&#x7C7B;&#x7684;&#x89C4;&#x7EA6;&#x521B;&#x5EFA;&#x51FA;&#x5B50;&#x7C7B;&#xFF0C;&#x518D;&#x4F7F;&#x7528;&#x5B50;&#x7C7B;&#x5B9E;&#x4F8B;&#x5316;&#x51FA;&#x6709;&#x610F;&#x4E49;&#x7684;&#x5BF9;&#x8C61;&#x3002;</p>
<p>&#x2003;&#x2003;Java&#x4E2D;&#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x79CD;&#x4E13;&#x95E8;&#x4F9B;&#x5B50;&#x7C7B;&#x6765;&#x7EE7;&#x627F;&#x7684;&#x7C7B;&#xFF0C;&#x8FD9;&#x4E2A;&#x7C7B;&#x5C31;&#x662F;&#x62BD;&#x8C61;&#x7C7B;&#xFF0C;&#x5176;&#x8BED;&#x6CD5;&#x5F62;&#x5F0F;&#x5982;&#x4E0B;&#x3002;</p>
<pre><code>abstract class &#x7C7B;&#x540D;{

}
</code></pre><p>&#x2003;&#x2003;Java&#x4E5F;&#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x79CD;&#x7279;&#x6B8A;&#x7684;&#x65B9;&#x6CD5;&#xFF0C;&#x8FD9;&#x4E2A;&#x65B9;&#x6CD5;&#x4E0D;&#x662F;&#x4E00;&#x4E2A;&#x5B8C;&#x6574;&#x7684;&#x65B9;&#x6CD5;&#xFF0C;&#x53EA;&#x542B;&#x6709;&#x65B9;&#x6CD5;&#x7684;&#x58F0;&#x660E;&#xFF0C;&#x6CA1;&#x6709;&#x65B9;&#x6CD5;&#x4F53;&#xFF0C;&#x8FD9;&#x6837;&#x7684;&#x65B9;&#x6CD5;&#x53EB;&#x505A;&#x62BD;&#x8C61;&#x65B9;&#x6CD5;&#xFF0C;&#x5176;&#x8BED;&#x6CD5;&#x5F62;&#x5F0F;&#x5982;&#x4E0B;&#x3002;</p>
<p>&#x2003;&#x2003;&#x5176;&#x4ED6;&#x4FEE;&#x9970;&#x7B26;abstract&#x8FD4;&#x56DE;&#x503C; &#x65B9;&#x6CD5;&#x540D;( );</p>
<h3 id="912--&#x62BD;&#x8C61;&#x7C7B;&#x7684;&#x4F7F;&#x7528;">9.1.2  &#x62BD;&#x8C61;&#x7C7B;&#x7684;&#x4F7F;&#x7528;</h3>
<p>&#x2003;&#x2003;&#x63A5;&#x4E0B;&#x6765;&#x901A;&#x8FC7;&#x4E00;&#x4E2A;&#x4F8B;&#x5B50;&#xFF0C;&#x4E86;&#x89E3;&#x62BD;&#x8C61;&#x7C7B;&#x7684;&#x4F7F;&#x7528;&#x3002;</p>
<p>&#x2003;&#x2003;&#x73B0;&#x6709;Person&#x7C7B;&#x3001;Chinese&#x7C7B;&#x548C;American&#x7C7B;&#x4E09;&#x4E2A;&#x7C7B;&#xFF0C;&#x5176;&#x4E2D;Person&#x7C7B;&#x4E3A;&#x62BD;&#x8C61;&#x7C7B;&#xFF0C;&#x542B;&#x6709;eat()&#x548C;work()&#x4E24;&#x4E2A;&#x62BD;&#x8C61;&#x65B9;&#x6CD5;&#xFF0C;&#x5176;&#x7C7B;&#x5173;&#x7CFB;&#x5982;&#x56FE;9.1&#x6240;&#x793A;&#x3002;</p>
<center><img src="https://labfile.oss.aliyuncs.com/library/textbook-java1/img/d9z/tu9.1.png"></center>
<center>&#x56FE;9.1  &#x62BD;&#x8C61;&#x7C7B;&#x4E4B;&#x95F4;&#x7684;&#x7C7B;&#x56FE;&#x5173;&#x7CFB;</center>  


<p>&#x2003;&#x2003;Person&#x7C7B;&#x7684;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#x3002;</p>
<pre><code>abstract class Person 

{

    String name = &quot;&#x4EBA;&quot;;

    String color = &quot;&#x80A4;&#x8272;&quot;;

    //&#x5B9A;&#x4E49;&#x5403;&#x996D;&#x7684;&#x62BD;&#x8C61;&#x65B9;&#x6CD5;eat()

    public abstract void eat();

    //&#x5B9A;&#x4E49;&#x5DE5;&#x4F5C;&#x7684;&#x62BD;&#x8C61;&#x65B9;&#x6CD5;eat()

    public abstract void work();

}
</code></pre><p>&#x2003;&#x2003;Chinese&#x7C7B;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#x3002;</p>
<pre><code>//&#x5B50;&#x7C7B;Chinese&#x7EE7;&#x627F;&#x81EA;&#x62BD;&#x8C61;&#x7236;&#x7C7B;Person

class Chinese extends Person

{

    String houseHold = &quot;&#x5317;&#x4EAC;&quot;;                              //&#x6237;&#x53E3;



    //&#x5B9E;&#x73B0;&#x7236;&#x7C7B;eat()&#x7684;&#x62BD;&#x8C61;&#x65B9;&#x6CD5;

    public void eat()

    {

        System.out.println(&quot;&#x4E2D;&#x56FD;&#x4EBA;&#x7528;&#x7B77;&#x5B50;&#x5403;&#x996D;&#xFF01;&quot;);

    }

    //&#x5B9E;&#x73B0;&#x7236;&#x7C7B;work()&#x7684;&#x62BD;&#x8C61;&#x65B9;&#x6CD5;

    public void work()

    {

        System.out.println(&quot;&#x4E2D;&#x56FD;&#x4EBA;&#x52E4;&#x52B3;&#x5DE5;&#x4F5C;&#xFF01;&quot;);

    }

}
</code></pre><p>&#x2003;&#x2003;American&#x7C7B;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#x3002;</p>
<pre><code>//&#x5B50;&#x7C7B;American&#x7EE7;&#x627F;&#x81EA;&#x62BD;&#x8C61;&#x7236;&#x7C7B;Person

class American extends Person

{

    String belief = &quot;&#x57FA;&#x7763;&#x6559;&quot;;                         //&#x4FE1;&#x4EF0;



    //&#x5B9E;&#x73B0;&#x7236;&#x7C7B;eat()&#x7684;&#x62BD;&#x8C61;&#x65B9;&#x6CD5;

    public void eat()

    {

        System.out.println(&quot;&#x7F8E;&#x56FD;&#x4EBA;&#x7528;&#x5200;&#x53C9;&#x5403;&#x996D;&#xFF01;&quot;);

    }

    //&#x5B9E;&#x73B0;&#x7236;&#x7C7B;work()&#x7684;&#x62BD;&#x8C61;&#x65B9;&#x6CD5;

    public void work()

    {

        System.out.println(&quot;&#x7F8E;&#x56FD;&#x4EBA;&#x5FEB;&#x4E50;&#x5DE5;&#x4F5C;&#xFF01;&quot;);

    }

}
</code></pre><p>&#x2003;&#x2003;&#x6D4B;&#x8BD5;&#x7C7B;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#x3002;</p>
<pre><code>class TestAbstract

{

    public static void main(String[] args) 

    {

        Person liuHL = new Chinese();      //&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x4E2D;&#x56FD;&#x4EBA;&#x5BF9;&#x8C61;

        System.out.println(&quot;***&#x4E2D;&#x56FD;&#x4EBA;&#x7684;&#x884C;&#x4E3A;***&quot;);

        liuHL.eat();                                               //&#x8C03;&#x7528;&#x4E2D;&#x56FD;&#x4EBA;&#x5403;&#x996D;&#x7684;&#x65B9;&#x6CD5;

        liuHL.work();                                 //&#x8C03;&#x7528;&#x4E2D;&#x56FD;&#x4EBA;&#x5DE5;&#x4F5C;&#x7684;&#x65B9;&#x6CD5;

        Person jacky = new American();    //&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x7F8E;&#x56FD;&#x4EBA;&#x5BF9;&#x8C61;

        System.out.println(&quot;***&#x7F8E;&#x56FD;&#x4EBA;&#x7684;&#x884C;&#x4E3A;***&quot;);

        jacky.eat();                                      //&#x8C03;&#x7528;&#x7F8E;&#x56FD;&#x4EBA;&#x5403;&#x996D;&#x7684;&#x65B9;&#x6CD5;

        jacky.work();                                  //&#x8C03;&#x7528;&#x7F8E;&#x56FD;&#x4EBA;&#x5DE5;&#x4F5C;&#x7684;&#x65B9;&#x6CD5;

    }

}
</code></pre><p>&#x2003;&#x2003;&#x7A0B;&#x5E8F;&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#x5982;&#x56FE;9.2&#x6240;&#x793A;&#x3002;</p>
<center><img src="https://labfile.oss.aliyuncs.com/library/textbook-java1/img/d9z/tu9.2.png"></center>
<center>&#x56FE;9.2  &#x62BD;&#x8C61;&#x7C7B;&#x4F7F;&#x7528;</center>  


<h3 id="913--&#x62BD;&#x8C61;&#x7C7B;&#x7684;&#x7279;&#x5F81;">9.1.3  &#x62BD;&#x8C61;&#x7C7B;&#x7684;&#x7279;&#x5F81;</h3>
<p>&#x2003;&#x2003;&#x5728;&#x4E0A;&#x9762;&#x4F8B;&#x5B50;&#x7684;&#x57FA;&#x7840;&#x4E0A;&#xFF0C;&#x53EF;&#x4EE5;&#x8FDB;&#x4E00;&#x6B65;&#x4E86;&#x89E3;&#x62BD;&#x8C61;&#x7C7B;&#x7684;&#x7279;&#x5F81;&#x3002;</p>
<p>&#x2003;&#x2003;&#xFF08;1&#xFF09;&#x62BD;&#x8C61;&#x7C7B;&#x4E0D;&#x80FD;&#x88AB;&#x76F4;&#x63A5;&#x5B9E;&#x4F8B;&#x5316;&#x3002;</p>
<p>&#x2003;&#x2003;&#x4F8B;&#x5982;&#xFF0C;&#x5728;&#x6D4B;&#x8BD5;&#x7C7B;&#x4EE3;&#x7801;&#x4E2D;&#x5199;&#x5982;&#x4E0B;&#x7684;&#x8BED;&#x53E5;&#x3002;</p>
<pre><code>Person liuHL = new Person();
</code></pre><p>&#x2003;&#x2003;&#x7F16;&#x8BD1;&#x65F6;&#x5C31;&#x4F1A;&#x62A5;&#x9519;&#xFF0C;&#x63D0;&#x793A;&#x62BD;&#x8C61;&#x7C7B;&#x65E0;&#x6CD5;&#x88AB;&#x5B9E;&#x4F8B;&#x5316;&#xFF0C;&#x5982;&#x56FE;9.3&#x6240;&#x793A;&#x3002;</p>
<center><img src="https://labfile.oss.aliyuncs.com/library/textbook-java1/img/d9z/tu9.3.png"></center>
<center>&#x56FE;9.3  &#x62BD;&#x8C61;&#x7C7B;&#x65E0;&#x6CD5;&#x88AB;&#x5B9E;&#x4F8B;&#x5316;</center>  



<p>&#x2003;&#x2003;&#xFF08;2&#xFF09;&#x62BD;&#x8C61;&#x7C7B;&#x7684;&#x5B50;&#x7C7B;&#x5FC5;&#x987B;&#x5B9E;&#x73B0;&#x62BD;&#x8C61;&#x65B9;&#x6CD5;&#xFF0C;&#x9664;&#x975E;&#x5B50;&#x7C7B;&#x4E5F;&#x662F;&#x62BD;&#x8C61;&#x7C7B;&#x3002;</p>
<p>&#x2003;&#x2003;&#x62BD;&#x8C61;&#x7C7B;&#x662F;&#x7236;&#x7C7B;&#x5BF9;&#x5B50;&#x7C7B;&#x7684;&#x89C4;&#x7EA6;&#xFF0C;&#x8981;&#x6C42;&#x5B50;&#x7C7B;&#x5FC5;&#x987B;&#x5B9E;&#x73B0;&#x62BD;&#x8C61;&#x7236;&#x7C7B;&#x7684;&#x62BD;&#x8C61;&#x65B9;&#x6CD5;&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x5982;&#x679C;&#x5C06;Chinese&#x7C7B;&#x7684;work&#x65B9;&#x6CD5;&#x53D8;&#x4E3A;&#x6CE8;&#x91CA;&#xFF0C;&#x4F7F;&#x62BD;&#x8C61;&#x7C7B;&#x4E2D;&#x7684;&#x62BD;&#x8C61;&#x65B9;&#x6CD5;&#x6CA1;&#x6709;&#x88AB;&#x5B50;&#x7C7B;&#x5B9E;&#x73B0;&#xFF0C;&#x7F16;&#x8BD1;&#x65F6;&#x62A5;&#x9519;&#xFF0C;&#x5982;&#x56FE;9.4&#x6240;&#x793A;&#x3002;</p>
<center><img src="https://labfile.oss.aliyuncs.com/library/textbook-java1/img/d9z/tu9.4.png"></center>
<center>&#x56FE;9.4  &#x62BD;&#x8C61;&#x65B9;&#x6CD5;&#x5FC5;&#x987B;&#x88AB;&#x5B9E;&#x73B0; </center>  





<p>&#x2003;&#x2003;&#xFF08;3&#xFF09;&#x62BD;&#x8C61;&#x7C7B;&#x91CC;&#x53EF;&#x4EE5;&#x6709;&#x666E;&#x901A;&#x65B9;&#x6CD5;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x6709;&#x62BD;&#x8C61;&#x65B9;&#x6CD5;&#xFF0C;&#x4F46;&#x662F;&#x6709;&#x62BD;&#x8C61;&#x65B9;&#x6CD5;&#x7684;&#x7C7B;&#x5FC5;&#x987B;&#x662F;&#x62BD;&#x8C61;&#x7C7B;&#x3002;</p>
<p>&#x2003;&#x2003;&#x53BB;&#x6389;Person&#x7C7B;&#x524D;&#x7684;abstract&#x5173;&#x952E;&#x5B57;&#xFF0C;&#x4F7F;Person&#x7C7B;&#x4E0D;&#x518D;&#x662F;&#x62BD;&#x8C61;&#x7C7B;&#xFF0C;&#x5374;&#x542B;&#x6709;&#x62BD;&#x8C61;&#x65B9;&#x6CD5;&#xFF0C;&#x7F16;&#x8BD1;&#x65F6;&#x62A5;&#x9519;&#xFF0C;&#x5982;&#x56FE;9.5&#x6240;&#x793A;&#x3002;</p>
<center><img src="https://labfile.oss.aliyuncs.com/library/textbook-java1/img/d9z/tu9.5.png"></center>
<center>&#x56FE;9.5  &#x6709;&#x62BD;&#x8C61;&#x65B9;&#x6CD5;&#x7684;&#x7C7B;&#x5FC5;&#x987B;&#x662F;&#x62BD;&#x8C61;&#x7C7B; </center>  



<p>&#x2003;&#x2003;&#x9700;&#x8981;&#x6CE8;&#x610F;&#x7684;&#x662F;&#xFF0C;&#x62BD;&#x8C61;&#x7C7B;&#x91CC;&#x9762;&#x4E5F;&#x53EF;&#x4EE5;&#x6CA1;&#x6709;&#x62BD;&#x8C61;&#x65B9;&#x6CD5;&#xFF0C;&#x53EA;&#x662F;&#x628A;&#x539F;&#x6765;&#x7684;&#x7C7B;&#x524D;&#x9762;&#x52A0;&#x4E0A;abstract&#x5173;&#x952E;&#x5B57;&#xFF0C;&#x4F7F;&#x5176;&#x53D8;&#x4E3A;&#x62BD;&#x8C61;&#x7C7B;&#x3002;</p>
<h3 id="914--&#x62BD;&#x8C61;&#x7C7B;&#x7684;&#x5E94;&#x7528;">9.1.4  &#x62BD;&#x8C61;&#x7C7B;&#x7684;&#x5E94;&#x7528;</h3>
<p>&#x2003;&#x2003;&#x518D;&#x5206;&#x6790;&#x300A;&#x79DF;&#x8F66;&#x7CFB;&#x7EDF;&#x300B;&#xFF0C;&#x5F88;&#x81EA;&#x7136;&#x5730;&#x5C31;&#x4F1A;&#x60F3;&#x5230;&#xFF0C;&#x4E4B;&#x524D;Vehicle&#x7C7B;&#x4E2D;&#x7684;show()&#x65B9;&#x6CD5;&#x662F;&#x4E00;&#x4E2A;&#x7A7A;&#x65B9;&#x6CD5;&#xFF0C;&#x6CA1;&#x6709;&#x5B9E;&#x9645;&#x610F;&#x4E49;&#xFF0C;&#x6240;&#x4EE5;&#x53EF;&#x4EE5;&#x628A;&#x5B83;&#x5B9A;&#x4E49;&#x4E3A;&#x62BD;&#x8C61;&#x65B9;&#x6CD5;&#x3002;</p>
<p>&#x2003;&#x2003;&#x53E6;&#x5916;&#xFF0C;&#x5728;&#x8BB2;&#x89E3;&#x7EE7;&#x627F;&#x7684;&#x65F6;&#x5019;&#xFF0C;Truck&#x7C7B;&#x91CD;&#x5199;&#x4E86;Vehicle&#x7C7B;&#x7684;drive()&#x65B9;&#x6CD5;&#xFF0C;&#x800C;&#x4E14;&#x901A;&#x8FC7;&#x9700;&#x6C42;&#x53EF;&#x4EE5;&#x5224;&#x65AD;&#x51FA;&#xFF0C;&#x5982;&#x679C;&#x8FD8;&#x6709;&#x5176;&#x4ED6;&#x7C7B;&#x9700;&#x8981;&#x7EE7;&#x627F;&#x81EA;Vehicle&#x7C7B;&#xFF0C;&#x4E5F;&#x53EF;&#x80FD;&#x9700;&#x8981;&#x91CD;&#x5199;drive()&#x65B9;&#x6CD5;&#xFF0C;&#x5B9E;&#x73B0;&#x5404;&#x81EA;&#x884C;&#x9A76;&#x7684;&#x529F;&#x80FD;&#x3002;&#x6240;&#x4EE5;&#xFF0C;&#x53EF;&#x4EE5;&#x628A;Vehicle&#x7C7B;&#x7684;drive()&#x65B9;&#x6CD5;&#x5B9A;&#x4E49;&#x4E3A;&#x62BD;&#x8C61;&#x65B9;&#x6CD5;&#xFF0C;&#x628A;&#x539F;&#x6765;Vehicle&#x7C7B;&#x4E2D;drive()&#x65B9;&#x6CD5;&#x7684;&#x65B9;&#x6CD5;&#x4F53;&#x5B9E;&#x73B0;&#x4EE3;&#x7801;&#x79FB;&#x5230;Car&#x7C7B;&#x4E2D;&#xFF0C;&#x76F8;&#x5F53;&#x4E8E;Car&#x7C7B;&#x5B9E;&#x73B0;Vehicle&#x7C7B;drive()&#x62BD;&#x8C61;&#x65B9;&#x6CD5;&#x3002;</p>
<p>&#x2003;&#x2003;&#x4FEE;&#x6539;&#x540E;Vehicle&#x7C7B;&#x7684;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#x3002;</p>
<pre><code>package com.bd.zuche;

//&#x8F66;&#x7C7B;&#xFF0C;&#x662F;&#x7236;&#x7C7B;&#xFF0C;&#x62BD;&#x8C61;&#x7C7B;

public abstract class Vehicle 

{

    String name = &quot;&#x6C7D;&#x8F66;&quot;;                   //&#x8F66;&#x540D;

    int oil = 20;                                              //&#x6CB9;&#x91CF;

    int loss = 0;                                              //&#x8F66;&#x635F;&#x5EA6;



    //&#x62BD;&#x8C61;&#x65B9;&#x6CD5;&#xFF0C;&#x663E;&#x793A;&#x8F66;&#x8F86;&#x4FE1;&#x606F;

    public abstract void show();

    //&#x62BD;&#x8C61;&#x65B9;&#x6CD5;&#xFF0C;&#x884C;&#x9A76;

    public abstract void drive();

    //&#x52A0;&#x6CB9;

    public void addOil()

    {

        if(oil &gt; 40)                   

        {

            oil = 60;

            System.out.println(&quot;&#x90AE;&#x7BB1;&#x5DF2;&#x52A0;&#x6EE1;!&quot;);

        }else{                  

            oil = oil + 20;

        }

        System.out.println(&quot;&#x52A0;&#x6CB9;&#x5B8C;&#x6210;!&quot;);

    }

    //&#x7701;&#x7565;&#x4E86;&#x6784;&#x9020;&#x65B9;&#x6CD5;&#x3001;getter&#x65B9;&#x6CD5;

}
</code></pre><p>&#x2003;&#x2003;Car&#x7C7B;&#x7684;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#x3002;</p>
<pre><code>package com.bd.zuche;

//&#x8F7F;&#x8F66;&#x7C7B;&#xFF0C;&#x662F;&#x5B50;&#x7C7B;&#xFF0C;&#x7EE7;&#x627F;Vehicle&#x7C7B;

public class Car extends Vehicle 

{

    private String brand = &quot;&#x7EA2;&#x65D7;&quot;;       //&#x54C1;&#x724C;

    //&#x5B50;&#x7C7B;&#x91CD;&#x5199;&#x7236;&#x7C7B;&#x7684;show()&#x62BD;&#x8C61;&#x65B9;&#x6CD5;

    public void show()

    {

        System.out.println(&quot;&#x663E;&#x793A;&#x8F66;&#x8F86;&#x4FE1;&#x606F;&#xFF1A;\n&#x8F66;&#x8F86;&#x540D;&#x79F0;&#x4E3A;&#xFF1A;&quot; + this.name + &quot; &#x54C1;&#x724C;&#x662F;&#xFF1A;&quot; + this.brand + &quot; 

        &#x6CB9;&#x91CF;&#x662F;&#xFF1A;&quot; + this.oil + &quot; &#x8F66;&#x635F;&#x5EA6;&#x4E3A;&#xFF1A;&quot; + this.loss);

        //System.out.println(&quot;&#x663E;&#x793A;&#x8F66;&#x8F86;&#x4FE1;&#x606F;&#xFF1A;\n&#x8F66;&#x8F86;&#x540D;&#x79F0;&#x4E3A;&#xFF1A;&quot; + getName() + &quot; &#x54C1;&#x724C;&#x662F;&#xFF1A;&quot; + this.brand + &quot;

        //&#x6CB9;&#x91CF;&#x662F;&#xFF1A;&quot; + getOil() + &quot; &#x8F66;&#x635F;&#x5EA6;&#x4E3A;&#xFF1A;&quot; + getLoss());

     }       

        //&#x5B50;&#x7C7B;&#x91CD;&#x5199;&#x7236;&#x7C7B;&#x7684;drive()&#x62BD;&#x8C61;&#x65B9;&#x6CD5;

     public void drive()

     {

        if(oil &lt; 10)

        {       

            System.out.println(&quot;&#x6CB9;&#x91CF;&#x4E0D;&#x8DB3;10&#x5347;&#xFF0C;&#x9700;&#x8981;&#x52A0;&#x6CB9;&#xFF01;&quot;);

        }else{

            System.out.println(&quot;&#x6B63;&#x5728;&#x884C;&#x9A76;!&quot;);

            oil = oil - 5;

            loss = loss + 10;

        }

    }

//&#x7701;&#x7565;&#x4E86;&#x6784;&#x9020;&#x65B9;&#x6CD5;&#x3001;getter&#x65B9;&#x6CD5;

}
</code></pre><p>&#x2003;&#x2003;Truck&#x7C7B;&#x548C;Driver&#x7C7B;&#x7684;&#x4EE3;&#x7801;&#x90FD;&#x6CA1;&#x53D1;&#x751F;&#x53D8;&#x5316;&#xFF0C;&#x8FD0;&#x884C;&#x6D4B;&#x8BD5;&#x7C7B;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#x3002;</p>
<pre><code>import com.bd.zuche.*;

class TestZuChe 

{

    public static void main(String[] args) 

    {

        Vehicle car = new Car(&quot;&#x6218;&#x795E;&quot;,&quot;&#x957F;&#x57CE;&quot;);                 //&#x521D;&#x59CB;&#x5316;&#x8F7F;&#x8F66;&#x5BF9;&#x8C61;car

        Vehicle truck = new Truck(&quot;&#x5927;&#x529B;&#x58EB;&#x4E8C;&#x4EE3;&quot;,&quot;10&#x5428;&quot;);          //&#x521D;&#x59CB;&#x5316;&#x5361;&#x8F66;&#x5BF9;&#x8C61;truck

        Driver d1 = new Driver(&quot;&#x67F3;&#x6D77;&#x9F99;&quot;);                    //&#x521B;&#x5EFA;&#x5E76;&#x521D;&#x59CB;&#x5316;&#x9A7E;&#x9A76;&#x5458;&#x5BF9;&#x8C61;

        d1.callShow(car);                       //&#x8C03;&#x7528;&#x9A7E;&#x9A76;&#x5458;&#x5BF9;&#x8C61;&#x7684;&#x76F8;&#x5E94;&#x65B9;&#x6CD5;

        d1.callShow(truck);                         //&#x8C03;&#x7528;&#x9A7E;&#x9A76;&#x5458;&#x5BF9;&#x8C61;&#x7684;&#x76F8;&#x5E94;&#x65B9;&#x6CD5;

    }

}
</code></pre><p>&#x2003;&#x2003;&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#x5982;&#x56FE;9.6&#x6240;&#x793A;&#x3002;</p>
<center><img src="https://labfile.oss.aliyuncs.com/library/textbook-java1/img/d9z/tu9.6.png"></center>
<center>&#x56FE;9.6  &#x7528;&#x62BD;&#x8C61;&#x7C7B;&#x5B8C;&#x6210;&#x201C;&#x79DF;&#x8F66;&#x7CFB;&#x7EDF;&#x201D;</center>  






                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="d9z.html" class="navigation navigation-prev " aria-label="Previous page: 第九章    抽象类和接口">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="9.2接口.html" class="navigation navigation-next " aria-label="Next page: 9.2  接口">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"9.1  抽象类","level":"1.10.1","depth":2,"next":{"title":"9.2  接口","level":"1.10.2","depth":2,"path":"chapters/d9z/9.2接口.md","ref":"chapters/d9z/9.2接口.md","articles":[]},"previous":{"title":"第九章    抽象类和接口","level":"1.10","depth":1,"path":"chapters/d9z/d9z.md","ref":"chapters/d9z/d9z.md","articles":[{"title":"9.1  抽象类","level":"1.10.1","depth":2,"path":"chapters/d9z/9.1抽象类.md","ref":"chapters/d9z/9.1抽象类.md","articles":[]},{"title":"9.2  接口","level":"1.10.2","depth":2,"path":"chapters/d9z/9.2接口.md","ref":"chapters/d9z/9.2接口.md","articles":[]},{"title":"9.3  本章练习","level":"1.10.3","depth":2,"path":"chapters/d9z/9.3本章练习.md","ref":"chapters/d9z/9.3本章练习.md","articles":[]}]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"chapters/d9z/9.1抽象类.md","mtime":"2020-04-22T12:28:14.242Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-04-22T12:09:46.327Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

